//
//  BaseService.h
//  CqlivingCloud
//
//  Created by xinhualong on 16/4/22.
//  Copyright © 2016 xinhualong. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AFNetworking.h"
#import "AFNetworkReachabilityManager.h"

typedef void(^ProgressBlock)(NSProgress *progress);
typedef void(^SuccessBlock)(NSURLSessionDataTask *task,id response);
typedef void(^FailureBlock)(NSURLSessionDataTask *task, NSError *error);

@interface BaseService : NSObject

+ (instancetype)sharedInstance;
+ (AFHTTPSessionManager *)getSessionManager;
+ (NSString *)getRequestUrlString:(NSString *)str ;
+ (NSString *)getIDFA;
+ (NSString *)friendlyDeviceName ;
+ (BOOL)isSimulator;
+ (NSString *)checkNetworkPermission;
+ (NSString *)getTimeStringSince1970;

@property (nonatomic, copy) NSString *requestBaseUrl;
//
+ (NSString *)getRequestUrlString:(NSString *)str;

#pragma mark -
/**
 */
+ (void)requestForHttpGet:(NSString *)urlString
               parameters:(NSDictionary *)par
                  success:(SuccessBlock)successBlock
                  failure:(FailureBlock)failereBlock;

/**
 */
+ (void)requestForHttpPost:(NSString *)urlString
                parameters:(NSDictionary *)par
                   success:(SuccessBlock)successBlock
                   failure:(FailureBlock)failereBlock;

//upload pictures
+ (void)postImageWithUrlString:(NSString *)urlString
                    parameters:(NSDictionary *)par
                     imageData:(NSData *)data
                      progress:(ProgressBlock)progressBlock
                       success:(SuccessBlock)successBlock
                       failure:(FailureBlock)failureBlock;
/**
 */
//+ (void)requestForHttpGet:(NSString *)urlString
//               parameters:(NSDictionary *)par
//                 progress:(ProgressBlock)progressBlock
//                  success:(SuccessBlock)successBlock
//                  failure:(FailureBlock)failureBlock;
//
//
///**
//
// */
//+ (void)requestForHttpPost:(NSString *)urlString
//                parameters:(NSDictionary *)par
//                  progress:(ProgressBlock)progressBlock
//                   success:(SuccessBlock)successBlock
//                   failure:(FailureBlock)failureBlock;



@end
